package com.ucs.restlet.firststep;

import org.restlet.Application;
import org.restlet.Component;
import org.restlet.Restlet;
import org.restlet.data.Protocol;
import org.restlet.routing.Router;
import org.restlet.routing.VirtualHost;
import org.restlet.util.ServerList;

public class FirstStepsApplication extends Application{

	@Override
	public Restlet createInboundRoot() {
		Router router = new Router(getContext());
		router.attach("/hello", HelloWorldResource.class);
		return router;
	}
	
	public static void main(String[] args) {
		Component component = new Component();
		ServerList serverList = component.getServers();
		serverList.add(Protocol.HTTP, 8182);
		VirtualHost virtualHost = component.getDefaultHost();
		virtualHost.attach(new FirstStepsApplication());
		try {
			component.start();			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
